﻿using System;
using System.IO;
using System.Collections.Generic;

class RemoveOddLines
{
    static void Main()
    {
        StreamReader readFile = new StreamReader("filetoedit.txt");
        List<string> strList = new List<string>();
        using (readFile)
        {
            int line = 1;
            string strReaded = readFile.ReadLine();
            Console.WriteLine("The file is:");
            Console.WriteLine();
            while (strReaded != null)
            {
                Console.WriteLine(strReaded);
                if(line % 2 == 0)
                strList.Add(strReaded);
                line++;
                strReaded = readFile.ReadLine();
            }
        }
        StreamWriter editFile = new StreamWriter("filetoedit.txt");
        using(editFile)
        {     
            for (int index = 0; index < strList.Count; index++)
            {
                string line = strList[index];
                editFile.WriteLine(line);
            }
        }
        
    }
}

